package com.framework.entity;

import com.framework.entity.base.BapBaseTimeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.UUID;

/**
 * @Description: 合并后文件存储实体类
 * @Author: JamesYao
 * @DateTime: 2024/1/16 23:26
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "merge_file")
public class MergeFile extends BapBaseTimeEntity {

    @Comment("当前文件唯一标识符")
    @Column(name = "file_id",nullable = false,length = 128)
    private String fileId;

    @Comment("用户ID")
    @Type(type = "uuid-char")
    @Column(name = "file_user_id",nullable = false,length = 128)
    private UUID userId;

    @Comment("用户名")
    @Column(name = "file_user_name",length = 256)
    private String userName;

    @Comment("文件名")
    @Column(length = 256)
    private String name;

    @Comment("文件加密后的SHA256")
    @Column(length = 256)
    private String hash;

    @Comment("文件大小")
    @Column(name = "file_size",length = 128)
    private Long size;

    @Comment("文件类型（文件：0或文件夹：1）")
    @Column(length = 16)
    private int type;

    @Comment("上级文件夹id（只能是文件夹的id）")
    @Column(length = 128)
    private String pid;
}
